Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1953 The bond between two Functional Group abbreviations disappears #2282

Conversation

yuleicul
Copy link
Collaborator

Resolves: #1953

Comment on lines 221 to +238
static isBondInContractedFunctionalGroup(
bond,
sgroups,
functionalGroups,
sgroupsFromReStruct: boolean
): boolean {
const contractedFunctionalGroupsAtoms: number[] = []
if (sgroupsFromReStruct) {
sgroups.forEach((sg) => {
if (
FunctionalGroup.isContractedFunctionalGroup(
sg.item.id,
functionalGroups
)
) {
contractedFunctionalGroupsAtoms.push(...sg.item.atoms)
}
})
} else {
sgroups.forEach((sg) => {
if (
FunctionalGroup.isContractedFunctionalGroup(sg.id, functionalGroups)
) {
contractedFunctionalGroupsAtoms.push(...sg.atoms)
}
})
}
return (
contractedFunctionalGroupsAtoms.includes(bond.begin) &&
contractedFunctionalGroupsAtoms.includes(bond.end)
)
bond: Bond,
sGroups: Map<number, ReSGroup> | Pool<SGroup>,
functionalGroups: Pool<FunctionalGroup>
) {
return [...sGroups.values()].some((sGroup) => {
const sGroupId = 'item' in sGroup ? sGroup.item.id : sGroup.id
const atomsInSGroup = 'item' in sGroup ? sGroup.item.atoms : sGroup.atoms
const isContracted = FunctionalGroup.isContractedFunctionalGroup(
sGroupId,
functionalGroups
)
return (
isContracted &&
atomsInSGroup.includes(bond.begin) &&
atomsInSGroup.includes(bond.end)
)
})
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@yuleicul yuleicul linked an issue Feb 27, 2023 that may be closed by this pull request
@KonstantinEpam23 KonstantinEpam23 merged commit d0d8f70 into release/2.8 Feb 28, 2023
@KonstantinEpam23 KonstantinEpam23 deleted the #1953-the-bond-between-two-functional-group-abbreviations-dissapears branch February 28, 2023 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The bond between two Functional Group abbreviations dissapears
2 participants